% generation for IMT
clear;
disp('Channel Generation');
global sim_consts;

% Load simulation configuration data;
 sim_consts = L0_sim_consts_A4_orin_EPA5;


% Simulated SNR. Not used, could be any value but empty 
snr_db = 0;

% Set the simulated subframe number here
slot_num = 1;

data_ifft = zeros(8,79872); %79872 = 32*(2048+448)

channel_gen = 0;% Set to 0 for new channel data generation. Otherwise load channel data only.
MU_option = sim_consts.MU_option;



jump = 1; % 0 output r, 1 jump the process of caculating r

seed_in = fix(now*1e8);
tic
if MU_option == 0
    user_index = 1;
    for slot_count = 0:(slot_num-1)
        slot_count
        [channel_out,Outm,Outn,Ch1,seed_out] = L11_PassChannel(data_ifft,snr_db,slot_count,channel_gen,jump,seed_in,user_index);
    end;
else
    user_num = sim_consts.user_num;
    seed_in = zeros(1,user_num);
    for user_index = 1:user_num
        for slot_count = 0:(subframe_num-1)
            user_index
            slot_count
            [channel_out,Outm,Outn,Ch1,seed_out(user_index)] = L11_PassChannel(data_ifft,snr_db,slot_count,channel_gen,1,seed_in(user_index),user_index);
            seed_in(user_index) = seed_out(user_index);
        end;
    end;
end
toc

